package com.aloha.springframework.utils;

public class ClassUtils {

    public static ClassLoader getDefaultClassLoader() {
        ClassLoader classLoader = null;
        try {
            classLoader = Thread.currentThread().getContextClassLoader();
        } catch (Throwable ex) {
            // 什么都不做
        }
        if (classLoader == null) {
            // 如果未获取当前线程的上下文类加载器，获得当前ClassLoader的类加载器
            classLoader = ClassUtils.class.getClassLoader();
        }
        return classLoader;
    }


    public static boolean isCglibProxyClass(Class<?> clazz) {
        return (clazz != null && isCglibProxyClassName(clazz.getName()));
    }

    public static boolean isCglibProxyClassName(String className) {
        return (className != null && className.contains("$$"));
    }

}
